package com.shengruan.user.action;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.shengruan.admin.jdbc.OrdersJdbc;
import com.shengruan.admin.jdbc.ProductJdbc;
import com.shengruan.admin.jdbc.ShippingJdbc;
import com.shengruan.admin.jdbc.UserAddressJdbc;
import com.shengruan.admin.vo.Orders;
import com.shengruan.admin.vo.Product;
import com.shengruan.admin.vo.Shipping;
import com.shengruan.admin.vo.User;
import com.shengruan.admin.vo.UserAddress;
import com.shengruan.common.BaseAction;
import com.shengruan.common.Constants;
import com.shengruan.common.Function;
import com.shengruan.common.alipay.AlipayBase;
import com.shengruan.common.alipay.AlipayService;

public class UserOrdersAction extends BaseAction {

    Logger logger = LoggerFactory.getLogger(getClass());

    private ProductJdbc productJdbc = (ProductJdbc) this.getJdbc(ProductJdbc.class);
    private ShippingJdbc shippingJdbc = (ShippingJdbc) this.getJdbc(ShippingJdbc.class);
    private UserAddressJdbc userAddressJdbc = (UserAddressJdbc) this.getJdbc(UserAddressJdbc.class);
    private OrdersJdbc ordersJdbc = (OrdersJdbc) this.getJdbc(OrdersJdbc.class);

    public void loadConfirmation() throws Exception {

        String[] productIdArray = this.inputs("id");

        if (ArrayUtils.isEmpty(productIdArray)) {
            this.redirect("/user/user-bided-product-list.ac");
            return;
        }

        List<Product> orderProductList = new ArrayList<Product>();
        for (String id : productIdArray) {
            orderProductList.add(this.productJdbc.getById(Integer.valueOf(id)));
        }


        if (orderProductList.size() > 1) {
            for (Product product : orderProductList) {
                if (product.getPhoneCardIf() == 1) {


                    List<Product> bidedProductList = this.productJdbc.getBidedProduct(this.getCurrentUser().getId(), Constants.PRODUCT_DISABLE_DAYS);
                    this.setRequest(Constants.MESSAGE, "订单中不能同时包含电话卡和其他商品，请将电话卡单独生成订单");
                    this.setRequest("bidedProductList", bidedProductList);
                    this.forward("/user/user-bided-product-list.jsp");

                    return;
                }
            }
        }


        List<Shipping> shippingList = this.shippingJdbc.findAll();
        UserAddress userAddress = this.userAddressJdbc.getByUserId(this.getCurrentUser().getId());

        this.setRequest("userAddress", userAddress);
        this.setRequest("shippingList", shippingList);
        this.setRequest("orderProductList", orderProductList);

        this.saveToken();

        if (orderProductList.size() == 1 && orderProductList.get(0).getPhoneCardIf() == 1) {
            this.forward("/user/user-order-confirmation-phoneCard.jsp");
        } else {
            this.forward("/user/user-order-confirmation.jsp");
        }
    }

    public void details() throws Exception {

        String id = this.input("id");
        if (StringUtils.isEmpty(id)) {
            this.redirect("/user/user-order-list.ac");
            return;
        }

        Orders orders = this.ordersJdbc.getById(this.getCurrentUser().getId(), Integer.valueOf(id));

        List<Product> orderProductList = this.productJdbc.getByOrderId(orders.getId());
        Shipping shipping = this.shippingJdbc.getById(orders.getShippingId());

        this.setRequest("orders", orders);
        this.setRequest("shipping", shipping);
        this.setRequest("orderProductList", orderProductList);

        this.saveToken();

        if (orderProductList.size() == 1 && orderProductList.get(0).getPhoneCardIf() == 1) {
            this.forward("/user/user-order-details-phoneCard.jsp.jsp");
        }else{
            this.forward("/user/user-order-details.jsp");
        }
    }


    /**
     * 用户提交订单
     *
     * @throws Exception
     */
    public void confirmation() throws Exception {
        //表单重复提交
        if (this.isTokenValid()) {
            this.redirect("/user/user-bided-product-list.ac");
            return;
        }

        StringBuilder alibody = new StringBuilder();
        List<Product> productList = new ArrayList<Product>();
        String[] productIdArray = this.inputs("productIdList");
        for (String id : productIdArray) {
            Product product = this.productJdbc.getById(Integer.valueOf(id));
            productList.add(product);
            alibody.append(product.getName() + "/");
        }

        String shippingId = this.input("shippingId");
        String description = this.input("description");
        String totalProductAmount = this.input("totalProductAmount");
        String pay_bank = this.input("pay_bank");

        User sessionUser = (User) this.request.getSession().getAttribute(Constants.USER);
        UserAddress userAddress = this.userAddressJdbc.getByUserId(this.getCurrentUser().getId());
        Shipping shipping = this.shippingJdbc.getById(Integer.valueOf(shippingId));

        PropertiesConfiguration config = new PropertiesConfiguration("AlipayConfig.properties");
        String input_charset = config.getString("CharSet");
        String sign_type = config.getString("sign_type");
        String seller_email = config.getString("sellerEmail");
        String partner = config.getString("partnerID");
        String key = config.getString("key");


        String show_url = config.getString("show_url");
        String notify_url = config.getString("order_notify_url");
        String return_url = config.getString("order_return_url");

        String antiphishing = config.getString("antiphishing");

        ///////////////////////////////////////////////////////////////////////////////////


        //以下参数是需要通过下单时的订单数据传入进来获得
        //必填参数
        String out_trade_no = DateFormatUtils.format(new Date(), "yyyyMMddHHmmss");//调取支付宝工具类生成订单号,请与贵网站订单系统中的唯一订单号匹配
        //订单名称，显示在支付宝收银台里的“商品名称”里，显示在支付宝的交易管理的“商品名称”的列表里。
        String subject = alibody.toString();
        //订单描述、订单详细、订单备注，显示在支付宝收银台里的“商品描述”里
        String body = alibody.toString();
        //订单总金额，显示在支付宝收银台里的“应付总额”里
        String total_fee = Double.valueOf(totalProductAmount) + shipping.getAmount() + "";

        //扩展功能参数——网银提前
        String pay_mode = pay_bank;
        String paymethod = "";        //默认支付方式，四个值可选：bankPay(网银); cartoon(卡通); directPay(余额); CASH(网点支付)
        String defaultbank = "";    //默认网银代号，代号列表见http://club.alipay.com/read.php?tid=8681379
        if (pay_mode.equals("directPay")) {
            paymethod = "directPay";
        } else {
            paymethod = "bankPay";
            defaultbank = pay_mode;
        }

        //扩展功能参数——防钓鱼
        String encrypt_key = new Date().getTime() + "";                    //防钓鱼时间戳，初始值
        String exter_invoke_ip = Function.getIpAddr(request);                    //客户端的IP地址，初始值
        if (antiphishing.equals("1")) {
            encrypt_key = AlipayBase.query_timestamp(partner);
            exter_invoke_ip = Function.getIpAddr(request);                    //获取客户端的IP地址，建议：编写获取客户端IP地址的程序
        }

        //扩展功能参数——其他
        String extra_common_param = "";                //自定义参数，可存放任何内容（除=、&等特殊字符外），不会显示在页面上
        String buyer_email = userAddress.getMobileNumber();                    //默认买家支付宝账号

        //扩展功能参数——分润(若要使用，请按照注释要求的格式赋值)
        String royalty_type = "";                    //提成类型，该值为固定值：10，不需要修改
        String royalty_parameters = "";
        //提成信息集，与需要结合商户网站自身情况动态获取每笔交易的各分润收款账号、各分润金额、各分润说明。最多只能设置10条
        //提成信息集格式为：收款方Email_1^金额1^备注1|收款方Email_2^金额2^备注2
        //如：
        //royalty_type = "10"
        //royalty_parameters	= "111@126.com^0.01^分润备注一|222@126.com^0.01^分润备注二"

        //扩展功能参数——自定义超时(若要使用，请按照注释要求的格式赋值)
        //该功能默认不开通，需联系客户经理咨询
        //超时时间，不填默认是15天。八个值可选：1h(1小时),2h(2小时),3h(3小时),1d(1天),3d(3天),7d(7天),15d(15天),1c(当天)
        String it_b_pay = "";

        /////////////////////////////////////////////////////////////////////////////////////////////////////


        //POST方式传递，得到加密结果字符串。想POST方式传递，请把下面四行代码取消注释。
        String sHtmlText = AlipayService.BuildPostform(partner, seller_email, return_url, notify_url, show_url, out_trade_no,
                subject, body, total_fee, paymethod, defaultbank, encrypt_key, exter_invoke_ip, extra_common_param, buyer_email,
                royalty_type, royalty_parameters, it_b_pay, input_charset, key, sign_type);

        Orders orders = new Orders();
        orders.setUserId(sessionUser.getId());
        orders.setOrderNumber(out_trade_no);
        orders.setCreationTime(System.currentTimeMillis());
        orders.setFreight(shipping.getAmount());
        orders.setTotalprice(Double.valueOf(totalProductAmount) + shipping.getAmount());
        orders.setDescription(description);
        orders.setStatus(Constants.ORDERS_STATUS_AWAITING_PAYMENT);
        orders.setShippingId(Integer.valueOf(shippingId));
        orders.setRecipientName(userAddress.getRecipientName());
        orders.setStreetAddress(userAddress.getStreetAddress());
        orders.setZipCode(userAddress.getZipCode());
        orders.setPhoneNumber(userAddress.getPhoneNumber());
        orders.setMobileNumber(userAddress.getMobileNumber());
        orders.setProvince(userAddress.getProvince());
        orders.setCity(userAddress.getCity());
        orders.setArea(userAddress.getArea());
        orders.setEmail(this.getCurrentUser().getEmail());
        orders.setPayBank(pay_bank);
        ordersJdbc.save(orders, productList);

        this.setRequest("sHtmlText", sHtmlText);
        this.forward("/user/user-order-confirmation-alipayto.jsp");
    }



    /**
     * 用户提交订单
     *
     * @throws Exception
     */
    public void confirmationPhoneCard() throws Exception {
        //表单重复提交
        if (this.isTokenValid()) {
            this.redirect("/user/user-bided-product-list.ac");
            return;
        }

        StringBuilder alibody = new StringBuilder();
        List<Product> productList = new ArrayList<Product>();
        String[] productIdArray = this.inputs("productIdList");
        for (String id : productIdArray) {
            Product product = this.productJdbc.getById(Integer.valueOf(id));
            productList.add(product);
            alibody.append(product.getName() + "/");
        }

        String description = this.input("description");
        String totalProductAmount = this.input("totalProductAmount");
        String pay_bank = this.input("pay_bank");
        String mobileNumber = this.input("mobileNumber");
        String recipientName = this.input("recipientName");

        User sessionUser = (User) this.request.getSession().getAttribute(Constants.USER);

        PropertiesConfiguration config = new PropertiesConfiguration("AlipayConfig.properties");
        String input_charset = config.getString("CharSet");
        String sign_type = config.getString("sign_type");
        String seller_email = config.getString("sellerEmail");
        String partner = config.getString("partnerID");
        String key = config.getString("key");


        String show_url = config.getString("show_url");
        String notify_url = config.getString("order_notify_url");
        String return_url = config.getString("order_return_url");

        String antiphishing = config.getString("antiphishing");

        ///////////////////////////////////////////////////////////////////////////////////


        //以下参数是需要通过下单时的订单数据传入进来获得
        //必填参数
        String out_trade_no = DateFormatUtils.format(new Date(), "yyyyMMddHHmmss");//调取支付宝工具类生成订单号,请与贵网站订单系统中的唯一订单号匹配
        //订单名称，显示在支付宝收银台里的“商品名称”里，显示在支付宝的交易管理的“商品名称”的列表里。
        String subject = alibody.toString();
        //订单描述、订单详细、订单备注，显示在支付宝收银台里的“商品描述”里
        String body = alibody.toString();
        //订单总金额，显示在支付宝收银台里的“应付总额”里
        String total_fee = totalProductAmount;

        //扩展功能参数——网银提前
        String pay_mode = pay_bank;
        String paymethod = "";        //默认支付方式，四个值可选：bankPay(网银); cartoon(卡通); directPay(余额); CASH(网点支付)
        String defaultbank = "";    //默认网银代号，代号列表见http://club.alipay.com/read.php?tid=8681379
        if (pay_mode.equals("directPay")) {
            paymethod = "directPay";
        } else {
            paymethod = "bankPay";
            defaultbank = pay_mode;
        }

        //扩展功能参数——防钓鱼
        String encrypt_key = new Date().getTime() + "";                    //防钓鱼时间戳，初始值
        String exter_invoke_ip = Function.getIpAddr(request);                    //客户端的IP地址，初始值
        if (antiphishing.equals("1")) {
            encrypt_key = AlipayBase.query_timestamp(partner);
            exter_invoke_ip = Function.getIpAddr(request);                    //获取客户端的IP地址，建议：编写获取客户端IP地址的程序
        }

        //扩展功能参数——其他
        String extra_common_param = "";                //自定义参数，可存放任何内容（除=、&等特殊字符外），不会显示在页面上
        String buyer_email = mobileNumber;                    //默认买家支付宝账号

        //扩展功能参数——分润(若要使用，请按照注释要求的格式赋值)
        String royalty_type = "";                    //提成类型，该值为固定值：10，不需要修改
        String royalty_parameters = "";
        //提成信息集，与需要结合商户网站自身情况动态获取每笔交易的各分润收款账号、各分润金额、各分润说明。最多只能设置10条
        //提成信息集格式为：收款方Email_1^金额1^备注1|收款方Email_2^金额2^备注2
        //如：
        //royalty_type = "10"
        //royalty_parameters	= "111@126.com^0.01^分润备注一|222@126.com^0.01^分润备注二"

        //扩展功能参数——自定义超时(若要使用，请按照注释要求的格式赋值)
        //该功能默认不开通，需联系客户经理咨询
        //超时时间，不填默认是15天。八个值可选：1h(1小时),2h(2小时),3h(3小时),1d(1天),3d(3天),7d(7天),15d(15天),1c(当天)
        String it_b_pay = "";

        /////////////////////////////////////////////////////////////////////////////////////////////////////


        //POST方式传递，得到加密结果字符串。想POST方式传递，请把下面四行代码取消注释。
        String sHtmlText = AlipayService.BuildPostform(partner, seller_email, return_url, notify_url, show_url, out_trade_no,
                subject, body, total_fee, paymethod, defaultbank, encrypt_key, exter_invoke_ip, extra_common_param, buyer_email,
                royalty_type, royalty_parameters, it_b_pay, input_charset, key, sign_type);

        Orders orders = new Orders();
        orders.setUserId(sessionUser.getId());
        orders.setOrderNumber(out_trade_no);
        orders.setCreationTime(System.currentTimeMillis());
        orders.setFreight(0d);
        orders.setTotalprice(Double.valueOf(totalProductAmount));
        orders.setDescription(description);
        orders.setStatus(Constants.ORDERS_STATUS_AWAITING_PAYMENT);
        orders.setShippingId(0);
        orders.setRecipientName((recipientName));
        orders.setStreetAddress(null);
        orders.setZipCode(0);
        orders.setPhoneNumber(null);
        orders.setMobileNumber(mobileNumber);
        orders.setProvince(null);
        orders.setCity(null);
        orders.setArea(null);
        orders.setEmail(this.getCurrentUser().getEmail());
        orders.setPayBank(pay_bank);
        ordersJdbc.save(orders, productList);

        this.setRequest("sHtmlText", sHtmlText);
        this.forward("/user/user-order-confirmation-alipayto.jsp");
    }


    /**
     * 订单付款
     *
     * @throws Exception
     */
    public void payment() throws Exception {
        //表单重复提交
        if (this.isTokenValid()) {
            this.redirect("/user/user-order-list.ac");
            return;
        }

        String id = this.input("id");
        if (StringUtils.isEmpty(id)) {
            this.redirect("/user/user-order-list.ac");
            return;
        }

        Orders orders = this.ordersJdbc.getById(this.getCurrentUser().getId(), Integer.valueOf(id));
        List<Product> orderProductList = this.productJdbc.getByOrderId(orders.getId());

        StringBuilder alibody = new StringBuilder();
        for (Product product : orderProductList) {
            alibody.append(product.getName() + "/");
        }

        User sessionUser = (User) this.request.getSession().getAttribute(Constants.USER);

        PropertiesConfiguration config = new PropertiesConfiguration("AlipayConfig.properties");
        String input_charset = config.getString("CharSet");
        String sign_type = config.getString("sign_type");
        String seller_email = config.getString("sellerEmail");
        String partner = config.getString("partnerID");
        String key = config.getString("key");


        String show_url = config.getString("show_url");
        String notify_url = config.getString("order_notify_url");
        String return_url = config.getString("order_return_url");

        String antiphishing = config.getString("antiphishing");

        ///////////////////////////////////////////////////////////////////////////////////


        //以下参数是需要通过下单时的订单数据传入进来获得
        //必填参数
        String out_trade_no = orders.getOrderNumber();
        //订单名称，显示在支付宝收银台里的“商品名称”里，显示在支付宝的交易管理的“商品名称”的列表里。
        String subject = alibody.toString();
        //订单描述、订单详细、订单备注，显示在支付宝收银台里的“商品描述”里
        String body = alibody.toString();
        //订单总金额，显示在支付宝收银台里的“应付总额”里
        String total_fee = Double.valueOf(orders.getTotalprice()) + "";

        //扩展功能参数——网银提前
        String pay_mode = orders.getPayBank();
        String paymethod = "";        //默认支付方式，四个值可选：bankPay(网银); cartoon(卡通); directPay(余额); CASH(网点支付)
        String defaultbank = "";    //默认网银代号，代号列表见http://club.alipay.com/read.php?tid=8681379
        if (pay_mode.equals("directPay")) {
            paymethod = "directPay";
        } else {
            paymethod = "bankPay";
            defaultbank = pay_mode;
        }

        //扩展功能参数——防钓鱼
        String encrypt_key = new Date().getTime() + "";                    //防钓鱼时间戳，初始值
        String exter_invoke_ip = Function.getIpAddr(request);                    //客户端的IP地址，初始值
        if (antiphishing.equals("1")) {
            encrypt_key = AlipayBase.query_timestamp(partner);
            exter_invoke_ip = Function.getIpAddr(request);                    //获取客户端的IP地址，建议：编写获取客户端IP地址的程序
        }

        //扩展功能参数——其他
        String extra_common_param = "";                //自定义参数，可存放任何内容（除=、&等特殊字符外），不会显示在页面上
        String buyer_email = orders.getMobileNumber();                    //默认买家支付宝账号

        //扩展功能参数——分润(若要使用，请按照注释要求的格式赋值)
        String royalty_type = "";                    //提成类型，该值为固定值：10，不需要修改
        String royalty_parameters = "";
        //提成信息集，与需要结合商户网站自身情况动态获取每笔交易的各分润收款账号、各分润金额、各分润说明。最多只能设置10条
        //提成信息集格式为：收款方Email_1^金额1^备注1|收款方Email_2^金额2^备注2
        //如：
        //royalty_type = "10"
        //royalty_parameters	= "111@126.com^0.01^分润备注一|222@126.com^0.01^分润备注二"

        //扩展功能参数——自定义超时(若要使用，请按照注释要求的格式赋值)
        //该功能默认不开通，需联系客户经理咨询
        //超时时间，不填默认是15天。八个值可选：1h(1小时),2h(2小时),3h(3小时),1d(1天),3d(3天),7d(7天),15d(15天),1c(当天)
        String it_b_pay = "";

        /////////////////////////////////////////////////////////////////////////////////////////////////////


        //POST方式传递，得到加密结果字符串。想POST方式传递，请把下面四行代码取消注释。
        String sHtmlText = AlipayService.BuildPostform(partner, seller_email, return_url, notify_url, show_url, out_trade_no,
                subject, body, total_fee, paymethod, defaultbank, encrypt_key, exter_invoke_ip, extra_common_param, buyer_email,
                royalty_type, royalty_parameters, it_b_pay, input_charset, key, sign_type);

        this.setRequest("sHtmlText", sHtmlText);
        this.forward("/user/user-order-confirmation-alipayto.jsp");
    }

    /**
     * 取消订单
     *
     * @throws Exception
     */
    public void cancel() throws Exception {
        //表单重复提交
        if (this.isTokenValid()) {
            this.redirect("/user/user-order-list.ac");
            return;
        }

        String id = this.input("id");
        if (StringUtils.isEmpty(id)) {
            this.redirect("/user/user-order-list.ac");
            return;
        }

        /*Orders orders = this.ordersJdbc.getById(this.getCurrentUser().getId(), Integer.valueOf(id));
        orders.setStatus(Constants.ORDERS_STATUS_CANCEL);
        orders.setCancelTime(System.currentTimeMillis());*/
        this.ordersJdbc.deleteById(Integer.valueOf(id));

        this.redirect("/user/user-bided-product-list.ac");
    }

    /**
     * 确认收货
     *
     * @throws Exception
     */
    public void confirmReceipt() throws Exception {
        //表单重复提交
        if (this.isTokenValid()) {
            this.redirect("/user/user-order-list.ac");
            return;
        }

        String id = this.input("id");
        if (StringUtils.isEmpty(id)) {
            this.redirect("/user/user-order-list.ac");
            return;
        }

        Orders orders = this.ordersJdbc.getById(this.getCurrentUser().getId(), Integer.valueOf(id));
        orders.setStatus(Constants.ORDERS_STATUS_TRADING_SUCCESS);
        this.ordersJdbc.update(orders);
        this.redirect("/user/user-order-list.ac");

    }


    /**
     * 加载修改收件人信息页面
     *
     * @throws Exception
     */
    public void loadConsignee() throws Exception {
        UserAddress userAddress = this.userAddressJdbc.getByUserId(this.getCurrentUser().getId());
        this.setRequest("userAddress", userAddress);
        this.forward("/user/user-order-consignee.jsp");
    }

    /**
     * 保存收件人信息
     */
    public void editConsignee() {
        try {
            String id = this.input("id");
            String recipientName = this.input("recipientName");
            String province = this.input("province");
            String city = this.input("city");
            String area = this.input("area");
            String streetAddress = this.input("streetAddress");
            String zipCode = this.input("zipCode");
            String phoneNumber = this.input("phoneNumber");
            String mobileNumber = this.input("mobileNumber");

            UserAddress userAddress = null;
            if (StringUtils.isEmpty(id))
                userAddress = new UserAddress();
            else
                userAddress = this.userAddressJdbc.getById(Integer.valueOf(id));


            userAddress.setUserId(this.getCurrentUser().getId());
            userAddress.setRecipientName(recipientName);
            userAddress.setProvince(province);
            userAddress.setCity(city);
            userAddress.setArea(area);
            userAddress.setStreetAddress(streetAddress);
            userAddress.setZipCode(Integer.valueOf(zipCode));
            userAddress.setPhoneNumber(phoneNumber);
            userAddress.setMobileNumber(mobileNumber);

            if (StringUtils.isEmpty(id))
                this.userAddressJdbc.save(userAddress);
            else
                this.userAddressJdbc.update(userAddress);

            this.print("success");
        } catch (Exception e) {
            try {
                this.print("fail");
            } catch (IOException e1) {
                e1.printStackTrace();
            }
            e.printStackTrace();
        }
    }

    /**
     * 显示收件人信息
     *
     * @throws Exception
     */
    public void showConsignee() throws Exception {
        UserAddress userAddress = this.userAddressJdbc.getByUserId(this.getCurrentUser().getId());
        if (null == userAddress) {
            userAddress = new UserAddress();
            userAddress.setUserId(this.getCurrentUser().getId());
            userAddress.setRecipientName(this.getCurrentUser().getRealName());
            userAddress.setMobileNumber(this.getCurrentUser().getMobile());
            this.userAddressJdbc.save(userAddress);

            userAddress = this.userAddressJdbc.getByUserId(this.getCurrentUser().getId());
        }

        this.setRequest("userAddress", userAddress);
        this.forward("/user/user-order-consignee-show.jsp");
    }


    public void list() throws Exception {
        String status = this.input("status");

        List<Orders> ordersList = null;
        if (StringUtils.isNotEmpty(status)) {
            if (StringUtils.isNumeric(status)) {
                ordersList = this.ordersJdbc.findAll(this.getCurrentUser().getId(), Integer.valueOf(status));
            } else {
                ordersList = this.ordersJdbc.findAll(this.getCurrentUser().getId());
            }
        } else {
            ordersList = this.ordersJdbc.findAll(this.getCurrentUser().getId());
        }

        this.setRequest("ordersList", ordersList);
        this.forward("/user/user-order-list.jsp");
    }

}
